//深克隆
const deepClone = (obj: any) => {
  let result: any;
  if (typeof obj === 'object') {
    if (Array.isArray(obj)) {
      result = [];
      for (let i in obj) {
        result.push(deepClone(obj[i]));
      }
    } else if (obj === null) {
      result = null;
    } else if (obj.constructor === RegExp) {
      result = obj;
    } else {
      result = {};
      for (let i in obj) {
        result[i] = deepClone(obj[i]);
      }
    }
  } else {
    result = obj;
  }
  return result;
};
export default deepClone;
